<template>
  <div>
    <TableComp :records="records" @selectInfo="selectInfo"></TableComp>
    <h2 v-show="!this.records.length">没有就诊记录</h2>
  </div>
</template>

<script>
import TableComp from './components/TableComp.vue';


export default {
  name: 'App',
  data() {
    return {
      isShow: false,
      records: [
        {
          date: '2022-01-01',
          doctor: '张三',
          diagnosis: '感冒',
          prescription: '感冒药',
        },
        {
          date: '2022-02-01',
          doctor: '李四',
          diagnosis: '头疼',
          prescription: '止疼药',
        },
        {
          date: '2022-03-01',
          doctor: '王五',
          diagnosis: '腰痛',
          prescription: '止痛贴',
        }
      ],
    }
  },
  components: {
    TableComp,
  },
  methods: {
    selectInfo(info) {
      this.records = this.records.filter(item => item.doctor === info)
    },
  }

}
</script>

<style scoped lang='less'></style>